package com.whpost.service.dao.cwqf;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.whpost.service.entity.cwqf.HsCzy;
import com.whpost.service.entity.cwqf.TCwqfKhzf;
import com.whpost.service.entity.cwqf.TbCrmCustomer;
import org.apache.ibatis.annotations.*;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author YinZhuoyi
 * @since 2025-08-22
 */
public interface HsCzyMapper extends BaseMapper<HsCzy> {

    @Select("select * from hs_czy where ${ew.sqlSegment}")
    @Results(id="hsCzyMap",value = {
            @Result(column="ssjg_lsh",property="hsJg",
                    one=@One(
                            select="com.whpost.service.dao.cwqf.HsJgMapper.selectById")
            ),
            @Result(column="ssjg_lsh",property="ssjgLsh")
    })
    IPage<HsCzy> getHsCzyPage(Page<HsCzy> page, @Param("ew") QueryWrapper wrapper);

    @Select("select * from hs_czy where code = #{code}")
    HsCzy selectByCode(@Param("code") String code);

    //获取用户aes
    @Select("select aeskey from hs_czy where code=#{code}")
    String getAesKeyByCode(String code);

    //根据加密手机号查找记录
    @Select("select * from hs_czy where tel=#{tel} and rownum=1")
    HsCzy getHsCzyByTel(String tel);
}
